<%@ page import="org.jeecgframework.web.util.StaticValue" %>
<%@ page language="java" import="java.util.*" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/context/mytags.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <title>零件采购订单</title>
    <t:base type="jquery,easyui,tools,DatePicker"></t:base>
    <script type="text/javascript" src="plug-in/ckfinder/ckfinder.js"></script>
    <script type="text/javascript">
        $(function () {
// 	$("#formobj").Validform({
// 		tiptype:3,
// 		callback:function(form){

// 			return false;
// 		}
// 	});
        })
    </script>
</head>
<body>
<t:formvalid formid="formobj" dialog="false" usePlugin="password" layout="table"
             action="cbsProcurementNoteController.do?doAdd" tiptype="3" callback="subCallBack" ignoreHidden="true">
    <input type="hidden" name="id" value="${bus.id }">
    <input type="hidden" name="state" id="state">
    <input type="hidden" name="source" value="1">
    <div class="subtitle">
        <p>客户信息</p>
        <table class="nobordertable noborder">
            <c:if test="${not empty bus.procurementNo}">
                <tr>
                    <td class="al_r" width="20%">
                        <label>采购单编号:</label>
                    </td>
                    <td width="20%">
                            ${bus.procurementNo}
                    </td>
                </tr>
            </c:if>
            <tr>
                <td class="al_r" width="20%">
                    <label>客户类型:</label>
                </td>
                <td width="20%">
                    <label for="kh">
                        <input type="radio" checked="checked" name="clientType" onchange="loadInputType(0)" value="0"
                               id="kh">客户
                    </label>
                    <label for="dsf">
                        <input type="radio" onchange="loadInputType(1)"
                               <c:if test="${bus.clientType eq '1'}">checked="checked"</c:if> name="clientType"
                               value="1" id="dsf">第三方
                        <input type="hidden" id="clientType" value="0"/>
                    </label>
                </td>
                <td class="al_r" width="20%">
                    <label class="thirdparty">采购方:</label>
                </td>
                <td width="30%">
                    <input type="hidden" class="thirdparty"/>
                    <input name="procurement.id" type="hidden" id="procurement" value="${bus.procurement.id}">
                    <input name="departname" class="inputxt" readonly="readonly" nullmsg="请选择所属机构"
                           value="${bus.procurement.departname}"
                    />
                    <t:choose hiddenName="procurement" hiddenid="id" url="cbsInvoiceInfoController.do?zyOrgs"
                              name="orgList"
                              icon="icon-search" title="机构列表" textname="departname" isclear="false"
                              fun="getOrg"></t:choose>
                        <%--<input class="thirdparty" type="text" name="procurement" value="${bus.procurement }" dataType="*"/>--%>
                </td>
            </tr>
            <tr>
                <td class="al_r">
                    <label>影院名称:</label>
                </td>
                <td>
                    <input type="hidden" name="cinema.id" id="cinemaId" value="${bus.cinema.id }"/>
                    <input type="text" name="cinemaName" id="cinemaName" readonly="readonly" value="${bus.cinema.name }" style="width:75%"
                           dataType="*">
                    <t:choose url="zyCinemaController.do?zyChooseCmOfContact" name="cinemaList" icon="" height="450px"
                              title="选择影院" hiddenName="cinemaId" inputTextname="cinemaName" hiddenid="id"
                              textname="name" fun="getCinemaById"/>
                </td>
                <td class="al_r">
                    <label>影院地址:</label>
                </td>
                <td>
                    <span id="cinemaAddr">${bus.cinema.address }</span>
                </td>
            </tr>
            <tr>
                <td class="al_r">
                    <label>所属机构:</label>
                </td>
                <td>
                    <span id="departName">${bus.cinema.belongOrg.departname }</span>
                </td>
                <td class="al_r">
                    <label>影院所属省市:</label>
                </td>
                <td>
                    <span id="city">${bus.cinema.province.territoryName }<c:if
                            test="${not empty bus.cinema.city }">,${bus.cinema.city }</c:if></span>
                </td>
            </tr>
            <tr>
                <td class="al_r">
                    <label>联系人名称:</label>
                </td>
                <td>
                    <input type="hidden" name="linkmanId" id="linkmanId"/>
                    <input type="text" name="contactName" id="contactName" dataType="*" value="${bus.contactName }"  style="width:75%">
                    <t:choose url="cbsProcurementNoteController.do?zyChooseContactersList" name="contacterList" icon=""
                              height="450px" width="900px"
                              title="选择联系人" hiddenName="linkmanId" inputTextname="contactName" hiddenid="id"
                              textname="name" fun="getContactById" paramIds="cinemaId"/>
                </td>
                <td class="al_r">
                    <label>联系人电话:</label>
                </td>
                <td>
                    <input type="text" name="contactPhone" id="phone" dataType="cPhone" value="${bus.contactPhone }"  style="width:75%">
                </td>
            </tr>
            <tr>
                <td class="al_r">
                    <label>联系人邮箱:</label>
                </td>
                <td>
                    <input type="text" name="contactMail" id="mail" dataType="e" value="${bus.contactMail }"   style="width:75%">
                </td>
                <td class="al_r">
                    <label>传真:</label>
                </td>
                <td>
                    <input type="text" name="contactFax" id="fax" value="${bus.contactFax }"   style="width:75%">
                </td>
            </tr>
            <tr>
                <td class="al_r">
                    <label class="customer">服务地点:</label>
                </td>
                <td>
                    <input class="customer" type="text" name="servicePlace" value="${bus.servicePlace }"   style="width:75%"/>
                </td>
                <td class="al_r">
                    <label class="customer">是否需要上门服务:</label>
                </td>
                <td>
                    <input class="customer" type="checkbox" value="1"
                           <c:if test="${bus.isOnsiteServices eq '1' }">checked="checked"</c:if>
                           name="isOnsiteServices"/>
                </td>
            </tr>
            <tr>
                <td class="al_r">
                    <label>保修期:</label>
                </td>
                <td colspan="3">
                    <textarea rows="2"  style="width:90%"
                              name="warranty">${empty bus.warranty?'到货后3个月。请妥善保管收货单据用作保修凭据，并保留原包装箱。':bus.warranty }</textarea>
                </td>
            </tr>
            <tr>
                <td class="al_r">
                    <label class="customer">服务前提:</label>
                </td>
                <td colspan="3">
                    <textarea class="customer" rows="2"  style="width:90%"
                              name="servicesPremise">${bus.servicesPremise }</textarea>
                </td>
            </tr>
            <tr>
                <td class="al_r">
                    <label class="thirdparty">备注:</label>
                </td>
                <td colspan="3">
                    <textarea class="thirdparty" rows="2"  style="width:90%" name="comment">${bus.comment }</textarea>
                </td>
            </tr>
            <tr>
                <td class="al_r">
                    <label>服务描述:</label>
                </td>
                <td colspan="3">
                    <textarea rows="2" style="width:90%" name="servicesDes">${bus.servicesDes }</textarea>
                </td>
            </tr>
            <tr>
                <td class="al_r">
                    <label>开具发票:</label>
                </td>
                <td colspan="3">
                    <c:if test="${not empty bus}">
                        <t:dictSelect field="makeInvoice" type="radio" typeGroupCode="trueOfFlaseNum"
                                      defaultVal="${makeInvoice}"></t:dictSelect>
                    </c:if>
                    <c:if test="${empty bus}">
                        <t:dictSelect field="makeInvoice" type="radio" typeGroupCode="trueOfFlaseNum"
                                      defaultVal="1"></t:dictSelect>
                    </c:if>
                </td>
            </tr>
        </table>
    </div>
    <div class="subtitle" id="invoiceDiv">
        <p>发票信息</p> &nbsp;<a href="#" class="a-btn"
                             onclick="if(checkToSelectInvoice()){choose_invoiceList();}">选择开票信息</a>
        <input type="hidden" id="invoiceId" name="" value="">
        <input type="hidden" id="snapInvoiceId" name="invoice.id" value="${bus.invoice.id}">
        <t:choose url="cbsInvoiceInfoController.do?goInvoiceSelect" name="cbsInvoiceInfoList" icon="" height="450px"
                  paramIds="cinemaId,procurement,clientType" butishidden="true" clickName="invoiceList"
                  title="选择开票信息" hiddenName="invoiceId" inputTextname="" hiddenid="id" textname="name"
                  fun="getInvoiceById"/>
        <table class="nobordertable noborder">
            <tr class="zy" >
                <td class="al_r" width="20%">
                    <span style="color: red">*</span><label>发票抬头:</label>
                </td>
                <td width="70%" colspan="3">
                    <input type="text" name="invoice.invoiceTitle" id="invoiceTitle" value="${bus.invoice.invoiceTitle}" style="width:75%"/>
                </td>
            </tr>
            <tr class="zy">
                <td class="al_r" width="20%">
                    <span style="color: red">*</span><label>税号:</label>
                </td>
                <td width="70%" colspan="3">
                    <input type="text" name="invoice.clientTaxnum" id="clientTaxnum" value="${bus.invoice.clientTaxnum}" style="width:75%"/>
                </td>
            </tr>
            <tr class="zy">
                <td class="al_r" width="20%">
                    <span style="color: red">*</span><label>银行名称:</label>
                </td>
                <td width="30%">
                    <input type="text" name="invoice.clientBankname" id="clientBankname" value="${bus.invoice.clientBankname}" style="width:75%"/>
                </td>
                <td class="al_r">
                    <span style="color: red">*</span><label>银行账号:</label>
                </td>
                <td>
                    <input type="text" name="invoice.clientBankaccount" id="clientBankaccount"
                           value="${bus.invoice.clientBankaccount}" style="width:75%"/>
                </td>
                <td></td>
                <td></td>
            </tr>
            <tr>
                <td class="al_r">
                    <span style="color: red">*</span><label>电话:</label>
                </td>
                <td>
                    <input type="text" name="invoice.clientPhone" id="clientPhone"
                           value="${bus.invoice.clientPhone}" style="width:75%"/>
                </td>
                <td class="al_r">
                    <span style="color: red">*</span><label>联系人:</label>
                </td>
                <td>
                    <input type="text" name="invoice.clientName" id="clientName"
                           value="${bus.invoice.clientName}" style="width:75%"/>
                </td>
            </tr>
            <tr>
                <td colspan="4" align="center" width="100%" style="text-align:center">
                    <a class="easyui-linkbutton" onclick="addInvoice()">新增发票信息</a>&nbsp;&nbsp;
                    <%--<a class="easyui-linkbutton" onclick="setAsDefault()">设为默认</a>--%>
                </td>
            </tr>
        </table>
    </div>
    <div class="subtitle">
        <p>订购明细</p> &nbsp;<a href="#" onclick="choose_partInfoList();">零件添加</a>
        <input type="hidden" id="partId">
        <input type="hidden" id="partName" value="${not empty bus.partList?bus.id:'' }">

    </div>
    <table style="margin-top: 20px; line-height: 35px;" cellpadding="0" cellspacing="1" class="formtable"
           id="partInfoTab">
        <tr align="center">
            <td width="120px">配件号</td>
            <td width="120px">中文描述</td>
            <td width="120px">单位</td>
            <td width="120px">数量</td>
            <td width="120px">操作</td>
        </tr>
        <c:if test="${empty bus.partList }">
            <tr align="center" style="background-color: #FFFFFF;" id="partInfoNullmsg">
                <td colspan="5">请添加零件</td>
            </tr>
        </c:if>
        <c:forEach items="${bus.partList }" var="part">
            <tr align="center" style="background-color: #FFFFFF;">
                <input type="hidden" name="partIdStr" value="${part.partInfo.id }">
                <td>${part.partInfo.partNo }</td>
                <td>${part.partInfo.chineseDes }</td>
                <td>${part.partInfo.marketUnit }</td>
                <td><input type="text" name="partCount" class="easyui-numberbox" value="${part.num }"/></td>
                <td><a href="#" onclick="delrow(this)">删除</a></td>
            </tr>
        </c:forEach>
    </table>

    <div class="subtitle">
        <p>相关设备</p> &nbsp;<a href="#"
                             onclick="if($('#cinemaId').val()==''){$.Showmsg('请先选择影院');return false;}choose_equipmentList();">设备添加</a>
        <input type="hidden" id="equipmentId">
        <input type="hidden" id="equipmentSn" value="${not empty bus.paertEsList?bus.id:'' }">
    </div>
    <table style="margin-top: 20px; line-height: 35px;" cellpadding="0" cellspacing="1" class="formtable"
           id="equipmentTab">
        <tr align="center">
            <td>设备SN</td>
            <td>型号</td>
            <td>机型</td>
            <td>BP号</td>
            <td>安装日期</td>
            <td>保期截至日期</td>
            <td>操作</td>
        </tr>
        <c:if test="${empty bus.paertEsList }">
            <tr align="center" style="background-color: #FFFFFF;" id="equipmentNullmsg">
                <td colspan="8">请添加设备</td>
            </tr>
        </c:if>
        <tbody id="equipmentTabBody">
        <c:forEach items="${bus.paertEsList }" var="es">
        <tr align="center" style="background-color: #FFFFFF;">
            <input type="hidden" name="equipmentIdStr" value="${es.equipmentSpare.id }">
            <td>${es.equipmentSpare.sn }</td>
            <td>${es.equipmentSpare.item }</td>
            <td>${es.equipmentSpare.type.typeDesc }</td>
            <td><fmt:formatDate value="${es.equipmentSpare.sendDate }" pattern="yyyy-MM-dd"/></td>
            <td><fmt:formatDate value="${es.equipmentSpare.installDate }" pattern="yyyy-MM-dd"/></td>
            <td><fmt:formatDate value="${es.equipmentSpare.repairEndDate }" pattern="yyyy-MM-dd"/></td>
            <td><a href="#" onclick="delrow(this)">删除</a></td>
        </tr>
        </tbody>
        </c:forEach>
    </table>
    <t:choose url="cbsPartInfoController.do?cbsPartInfoSelList&canSale=1" name="cbsPartInfoList" icon="" height="450px"
              butishidden="true" clickName="partInfoList"
              title="选择零件" hiddenName="partId" inputTextname="partName" hiddenid="id" textname="partNo" fun="add_part"/>

    <t:choose url="cbsProcurementPartEsController.do?zyEquipmentSpareInfoSelList" name="zyEquipmentSpareList" icon=""
              height="450px" butishidden="true" clickName="equipmentList"
              title="选择设备" paramIds="cinemaId" hiddenName="equipmentId" inputTextname="equipmentSn" hiddenid="id"
              textname="sn" fun="add_equipment"/>
</t:formvalid>
<div style="text-align: center;margin: 10px;">
    <a class="easyui-linkbutton" onclick="save(4)">暂存</a>
    &nbsp;&nbsp;&nbsp;&nbsp;
    <a class="easyui-linkbutton" onclick="save(1)">提交</a>
    <c:if test="${not empty bus.id }">
        &nbsp;&nbsp;&nbsp;&nbsp;
        <a class="easyui-linkbutton" onclick="save(3)">取消采购单</a>
    </c:if>
</div>

</body>
<script type="text/javascript">
    var clientType = 0;
    $(function () {
        if (!$.isEmptyObject($("input[name='id']").val()) && "${makeInvoice}" == 0) {
            $("#invoiceDiv").hide();
        }

        $("input[name='makeInvoice']").click(function () {
            if ($(this).val() == 1) {
                $("#invoiceDiv").show();
            } else {
                $("#invoiceDiv").hide();
            }
        })

        var type = '${bus.clientType}';
        if (type == "") {
            type = 0;
        }
        loadInputType(type);
    })
    function getValue(val) {
        return val == undefined || val == null ? '' : val;
    }
    function genData(data) {
        $("#invoiceTitle").val(getValue(data.invoiceTitle));
        $("#dedInvoiceId").val(getValue(data.id));
        $("#clientBankname").val(getValue(data.clientBankname));
        $("#clientTaxnum").val(getValue(data.clientTaxnum));
        $("#clientBankaccount").val(getValue(data.clientBankaccount));
        $("#clientPhone").val(getValue(data.clientPhone));
        $("#clientName").val(getValue(data.clientName));
    }

    function getInvoiceById() {
        $.getJSON("cbsInvoiceInfoController.do?getInvoiceById", {id: $("#invoiceId").val()}, function (data) {
            if (!$.isEmptyObject(data)) {
                genData(data);
            }
        })
    }
    function loadInputType(type) {
        clientType = type;
        $("#clientType").val(type);
        if (type == 0) {
            $('.thirdparty').nextAll().andSelf().hide();
            $('.thirdparty').children().hide();
            $('.customer').nextAll().andSelf().show();
        } else {
            $('.customer').nextAll().andSelf().hide();
            $('.thirdparty').nextAll().andSelf().show();
            $('.thirdparty').children().show();
        }
    }

    function checkToSelectInvoice() {
        if (clientType == 0) {
            if ($('#cinemaId').val() == '') {
                $.Showmsg('请先选择影院');
                return false;
            }
        } else {
            if ($('#procurement').val() == '') {
                $.Showmsg('请先选择采购方');
                return false;
            }
        }
        return true;
    }

    function checkInvoice() {
        var re = false;
        if ($("input[name='makeInvoice']:checked").val() == 1) {
            if ($.isEmptyObject($("#clientTaxnum").val())
                    || $.isEmptyObject($("#clientBankname").val())
                    || $.isEmptyObject($("#clientBankaccount").val())
                    || $.isEmptyObject($("#clientPhone").val())
                    || $.isEmptyObject($("#clientName").val())) {
                $.Showmsg('发票信息不完整');
                return true;
            }
            if ($.isEmptyObject($("#invoiceTitle").val())) {
                $.Showmsg('发票抬头不能为空');
                return true;
            }
        }
        return re;
    }

    function save(type) {
        //第三方判断 是否选择采购方
        if (clientType == 1) {
            if ($("#procurement").val() == '') {
                $.Showmsg("请选择采购方");
                return;
            }
        }
        var flag = false;
        var msg = ""
        if (checkInvoice()) {
            return;
        }

        $('input[name="partCount"]').each(function () {
            if ($(this).val() == "") {
                msg = "请输入零件数量";
                flag = true;
                return;
            }
        });
        var partName = $('#partName').val();
        var sn = $('#equipmentSn').val();
        if (sn == '') {
            msg = "请选择至少一条设备";
            flag = true;
        }
        if (partName == '') {
            msg = "请选择至少一条零件";
            flag = true;
        }
        if (flag) {
            $.Showmsg(msg);
            return;

        }
        var esIdStr = '';
        $('input[name="equipmentIdStr"]').each(function () {
            esIdStr += $(this).val() + ',';
        });
        if ($("input[name='makeInvoice']").val() == 1) {
             $("#invoiceId").val($("#dedInvoiceId").val());
        } else {
            $("#invoiceId").val('');
        }
        $.post('cbsProcurementNoteController.do?inspectEquipment', {esIdStr: esIdStr}, function (data) {
            data = $.parseJSON(data);
            if (data == '1') {
                $.dialog.alert('选择的设备所属BP必须一致');
                return;
            } else if (data == '2') {
                $.dialog.alert('选择的设备必须全部在保,或者全部不再保');
                return;
            } else {
                $('#state').val(type);
                $('#formobj').submit();
            }
        });
    }

    function subCallBack(data) {
        top.tip(data.msg);
        if ('${bus.id }' != "") {
            //刷新列表
            var win = frameElement.api.opener;
            win.reloadTable();
            frameElement.api.close();
        } else {
            top.$('#maintabs').tabs('select', '零件采购');
            var tab = top.$('#maintabs').tabs("getSelected");
            tab.panel("refresh");
            closeCurrentTab('创建采购单');
        }

    }

    function buildInvoiceParam(){
        var param = {"belongCinema.id": $("#cinemaId").val(), genre: "<%=StaticValue.DIC_GENRE_CINEMA %>"};
        if (clientType == 1) {
            param = {"belongOrg.id": $("#procurement").val(), genre: "<%=StaticValue.DIC_GENRE_AGENCY %>"}
        }
        $.extend(param,{
            invoiceTitle : $("#invoiceTitle").val(),
            clientBankname:$("#clientBankname").val(),
            clientTaxnum:$("#clientTaxnum").val(),
            clientBankaccount:$("#clientBankaccount").val(),
            clientPhone:$("#clientPhone").val(),
            clientName:$("#clientName").val()
        });
        return param;
    }

    function addInvoice() {
        if (!checkToSelectInvoice()) {
            return;
        }
        if (!checkInvoice()) {
            var param = {"belongCinema.id": $("#cinemaId").val(), genre: "<%=StaticValue.DIC_GENRE_CINEMA %>"};
            if (clientType == 1) {
                param = {"belongOrg.id": $("#procurement").val(), genre: "<%=StaticValue.DIC_GENRE_AGENCY %>"}
            }

            $.post("cbsInvoiceInfoController.do?doAdd" , buildInvoiceParam(), function (data) {
                data = $.parseJSON(data);
                if (data.success) {
                    if (!$.isEmptyObject(data.obj)) {
                        $("#invoiceId").val(data.obj.id);
                        genData(data.obj);
                        top.tip("新增发票信息成功");
                    }
                } else {
                    $.Showmsg(data.msg);
                }
            })
        }
    }
    function initInvoiceInfo() {
        var id = $("#cinemaId").val();
        if (clientType == 1) {
            id = $("#procurement").val();
        }
        $.getJSON("cbsInvoiceInfoController.do?getDefaultInvoice", {
            id: id,
            clientType: clientType
        }, function (data) {
            $(".pt").find("input").val('');
            $(".zy").find("input").val('');
            if (!$.isEmptyObject(data)) {
                $.each(data, function (idx, itm) {
                    genData(itm);
                })
            }
        })
    }

    function getOrg() {
        if (clientType == 1) {
            initInvoiceInfo();
        }
    }

    function getCinemaById() {
        var id = $('#cinemaId').val();
        $("#equipmentTabBody").empty();
        $('input[name="equipmentIdStr"]').val('');
        $("#equipmentSn").val('');
        $("#linkmanId").val('');
        $("#contactName").val('');
        $.post('cbsProcurementPartEsController.do?getCinemaById', {id: id}, function (data) {
            data = $.parseJSON(data);
            $('#cinemaAddr').text(data.cinema.address == null ? "" : data.cinema.address);
            $('#departName').text(data.depart == null ? "" : data.depart);
            $('#city').text(data.city == null ? "" : data.city);
            if (clientType == 0) {
                initInvoiceInfo();
            }
        });
    }
    function getContactById() {
        var id = $('#linkmanId').val();
        $.post('cbsProcurementPartEsController.do?getContactById', {id: id}, function (data) {
            data = $.parseJSON(data);
            $('#phone').val(data.cellphone1 == null ? "" : data.cellphone1);
            $('#mail').val(data.email == null ? "" : data.email);
            $('#fax').val(data.fax == null ? "" : data.fax);
        });
    }

    function delrow(del) {
        $(del).parent().parent().remove();
    }

    function add_part() {
        $('#partInfoNullmsg').remove();
        var id = $('#partId').val();
        $('input[name="partIdStr"]').each(function () {
            if (id.indexOf($(this).val()) != -1) {
                id = id.replace($(this).val(), '');
            }
        })
        $.post('cbsPartInfoController.do?getPartInfoById', {id: id}, function (data) {
            data = $.parseJSON(data);
            var str = "";
            for (var i = 0; i < data.length; i++) {
                str += '<tr align="center" style="background-color: #FFFFFF;">';
                str += '<input type="hidden" name="partIdStr" value="' + data[i].id + '">';
                str += '<td>' + data[i].no + '</td>';
                str += '<td>' + data[i].chineseDes + '</td>';
                str += '<td>' + data[i].unit + '</td>';
                str += '<td><input type="text" name="partCount" class="easyui-numberbox" value="1"/></td>';
                str += '<td><a href="#" onclick="delrow(this)">删除</a></td>';
                str += '</tr>';
            }
            var targetObj = $(str).appendTo("#partInfoTab");

            $.parser.parse(targetObj);
        });
    }

    function add_equipment() {
        $('#equipmentNullmsg').remove();
        var id = $('#equipmentId').val();
        $('input[name="equipmentIdStr"]').each(function () {
            if (id.indexOf($(this).val()) != -1) {
                id = id.replace($(this).val(), '');
            }
        })
        $.post('cbsPartInfoController.do?getEquipmentIdById', {id: id}, function (data) {
            data = $.parseJSON(data);
            var str = "";
            for (var i = 0; i < data.length; i++) {
                str += '<tr align="center" style="background-color: #FFFFFF;">';
                str += '<input type="hidden" name="equipmentIdStr" value="' + data[i].id + '">';
                str += '<td>' + data[i].sn + '</td>';
                str += '<td>' + data[i].item + '</td>';
                str += '<td>' + data[i].type + '</td>';
                str += '<td>' + data[i].BP + '</td>';
                str += '<td>' + data[i].installDate + '</td>';
                str += '<td>' + data[i].repairEndDate + '</td>';
                str += '<td><a href="#" onclick="delrow(this)">删除</a></td>';
                str += '</tr>';
            }
            $(str).appendTo("#equipmentTabBody");

        });
    }


</script>